#include<iostream>
#include <unistd.h>

using namespace std;
int main()
{
	int ret=fork();
	if(ret ==0)
	{
		cout<<"子进程id："<<getpid()<<endl;
		sleep(5);
		exit(EXIT_SUCCESS);
	}
	else if(ret <0)
	{
		perror("fork");
		return 1;
	}
	else
	{
		cout<<"父进程id:"<<getpid()<<endl;
		sleep(30);	
	}
	return 0;
} 
